﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using SmallBusinessKit.DataAccess.Interfaces;
using SmallBusinessKit.Domains;
using SmallBusinessKit.Interfaces;
using SmallBusinessKit.Models.Entities;

namespace SmallBusinessKit.Tests.Domains
{
    /// <summary>
    /// Unit Tests for TestimonialDomain Logic
    /// </summary>
    /// /// <remarks>These tests don't really test anything ~ lol</remarks>
    [TestClass]
    public class TestimonialDomainTests : UnitTestBase
    {
        #region Properties

        private Mock<ITestimonialRepository>    _moqTestimonialRepository;
        private ITestimonialDomain              _domain;

        #endregion Properties

        #region Tests

        [TestInitialize]
        public override void Setup()
        {
            base.Setup();

            _moqTestimonialRepository = new Mock<ITestimonialRepository>();
            _domain = new TestimonialDomain(_moqTestimonialRepository.Object);

            var testimonials = XmlData.ParseTestimonials();
            _moqTestimonialRepository.Setup(m => m.GetMany(It.IsAny<Expression<Func<Testimonial, bool>>>())).Returns(testimonials);
        }

        [TestMethod]
        public void GetAllTestimonials()
        {
            // Act
            var results = _domain.GetAllTestimonials();

            // Assert
            Assert.IsNotNull(results);
            Assert.IsInstanceOfType(results, typeof(IEnumerable<Testimonial>));
        }

        #endregion
    }
}
